using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Sustainalytics.Synchronization.Interface;

namespace Sustainalytics.ReportGenerator.BL.Tests
{

    public static class TestSyncContextFactoy
    {
        const string GaMongoIp = "54.171.12.91";
        const string DsoMongoIp = "52.208.112.211";
        const string Redis = "52.209.225.41";
        const string DatabaseGroup = "B";

        public static SyncContext Create(Action<string> log = null)
        {
            var context = new SyncContext(ErrorPolicy.BreakRightAway, log)
            {
                GAConnectionStrings = new Dictionary<string, string>(),
                DSOConnectionStrings = new Dictionary<string, string>(),
                LastGAConnectionStrings = new Dictionary<string, string>(),
                Report = new ConcurrentBag<string>(),
                CompanyUniverses = new Dictionary<Guid, List<int>>(),
                PreviousChanges = new List<ChangedElement>(),
                SelectedSteps = new List<SyncStepOrder>() { SyncStepOrder.FocusedRatingsComputationOutput2 }

            };
            context.GAConnectionStrings["ClientPlatform"] = $"mongodb://{GaMongoIp}:27017/ClientPlatform";
            context.GAConnectionStrings["ClientUniverses"] = $"mongodb://{GaMongoIp}:27017/ClientUniverses";
            context.GAConnectionStrings["RPHistoricalDataSet"] = $"mongodb://{GaMongoIp}:27017/RPHistoricalDataSet";
            context.GAConnectionStrings["ClientDW"] = $"mongodb://{GaMongoIp}:27017/ClientDW_{DatabaseGroup}";
            context.LastGAConnectionStrings["ClientDW"] = $"mongodb://{GaMongoIp}:27017/ClientDW_{DatabaseGroup}";

            context.GAConnectionStrings["GovernanceDW"] = $"mongodb://{GaMongoIp}:27017/GovernanceDW_{DatabaseGroup}";
            context.LastGAConnectionStrings["GovernanceDW"] = $"mongodb://{GaMongoIp}:27017/GovernanceDW_{DatabaseGroup}";
            context.GAConnectionStrings["RedisConnectionString"] = Redis;

            context.DSOConnectionStrings["ScreeningDW"] = $"mongodb://{DsoMongoIp}:27017/ScreeningDW_{DatabaseGroup}";
            context.GAConnectionStrings["DWArchive"] = $"mongodb://{GaMongoIp}:27017/DWArchive_{DatabaseGroup}";
            context.GAConnectionStrings["ControversyReportPDF"] = $"mongodb://{GaMongoIp}:27017/ControversyReportPDF_{DatabaseGroup}";
            context.GAConnectionStrings["CompanyReportPDF"] = $"mongodb://{GaMongoIp}:27017/CompanyReportPDF_{DatabaseGroup}";
            context.GAConnectionStrings["ComputationServiceAddress"] = "http://52.19.60.134:10280/esgcomputingserv/api/v1";

            context.PreviousChanges = new List<ChangedElement> { (new ChangedElement()
            {
                AffectedObjectName = ChangedElement.DATA_SET_DELETE_SYNC_FAIL,
                AffectedDocumentId = new Guid("ff2e1b1b-c238-4070-bb63-37799c6b3c18")
            }) };
            return context;
        }
    }

}